const $ = new Env('今日头条_Jxell');
tim = getday()
var msg = ""
cookie = "excgd=" + tim + "; install_id=2560126249609613; ttreq=1$d166b90acf4b7e41e0193b30acd3af1eaf378c16; passport_csrf_token_default=76bde2e3e955e2de5d2661899cb1ed96; passport_csrf_token=76bde2e3e955e2de5d2661899cb1ed96; odin_tt=c7a27f6da565907e9446fafd28fab8c3e5bbc57a943f7f7a2a0d5cde0c888749f0e5e36ef33047b99388f0c8b7cabdbc1d421253b3ff8427ba8e7f4fb88ab592; n_mh=bH-Vbx-a_NNTC89e1Pkcr3cjiFHDkdhFmS9Kngu60Pc; sid_guard=142b8b1c4f7608d41756604a7e27d093%7C1639808111%7C5184000%7CWed%2C+16-Feb-2022+06%3A15%3A11+GMT; uid_tt=2504b7ab7de4e2c636ccb1f45c811729; uid_tt_ss=2504b7ab7de4e2c636ccb1f45c811729; sid_tt=142b8b1c4f7608d41756604a7e27d093; sessionid=142b8b1c4f7608d41756604a7e27d093; sessionid_ss=142b8b1c4f7608d41756604a7e27d093; d_ticket=b0d8d868dd4143aba3e66161b31aacf2b3b63"



!(async () => {
     readres = await read()
    if (msg!="") {
        await gobotNotify(readres)
    }
    //await gobotNotify("readres"+\n)
})()
    .catch((e) => $.logErr(e))
    .finally(() => $.done())



async function read() {
    return new Promise(resolve => {
        const options = {
            url: "https://api5-normal-hl.toutiaoapi.com/luckycat/lite/v1/activity/done_whole_scene_task/?pass_through=default&is_pad=0&act_token=IQwHrjCVgOpwkyCdRmSbY8gmtGfaa0RV4vF2zpM3V9jbC0oeGa3HR5Pskm4BCRnsLd1-R_3nshqhFoJxMSNK8Q&act_hash=188f1734eae0279cef8369f9c81eb6dc&cookie_base=DxSRTeF54oEiPPNxA0Q4sNTyf_PNNAs6-uYXzCW_d3DVBBtIyX9vxyXhcXvSoPoXWfePJPnRhssZ3dRPz6etiw&cookie_data=Mmt18x86g-eTl9C0ERF7-w&iid=2560126249609613&device_id=39501968239&ac=4g&channel=lite_xiaomi_64&aid=35&app_name=news_article_lite&version_code=854&version_name=8.5.4&device_platform=android&os=android&ab_version=668905%2C3613998%2C668906%2C3614006%2C668904%2C3613984%2C668903%2C3614024%2C668907%2C3485377%2C3614030%2C1859936%2C668908%2C3614034%2C3564446%2C3269751%2C3472847%2C3596061&ab_client=a1%2Ce1%2Cf2%2Cg2%2Cf7&ab_group=z2&ab_feature=z1&abflag=3&ssmix=a&device_type=MI+5X&device_brand=xiaomi&language=zh&os_api=27&os_version=8.1.0&manifest_version_code=8540&resolution=1080*1920&dpi=480&update_version_code=85409&_rticket=1641559659959&sa_enable=0&dq_param=1&plugin_state=280419485511709&session_id=6465d9af-7e4c-44f8-88b6-24262216b6c5&host_abi=arm64-v8a&tma_jssdk_version=2.8.0.14&rom_version=miui_v10_9.8.29&cdid=8153277d-5096-4781-87fa-b154da0d4413",
            json: {
                "group_id": "",
                "scene_key": "article_feed",
                "is_golden_egg": false
            },
            headers: {
                "Host": "api5-normal-hl.toutiaoapi.com",
                "x-ss-stub": "9475ED10240718E0A76A68D21F78C8A2",
                "x-ss-req-ticket": "1641559659965",
                "x-tt-dt": "AAAQNLTUEEPIMJBAYMULHISBVZCQN2GTFLOCYDEIDVLV2SWH7TDRCCA5F74LZ6GZSPVE5KJVTQQU773IKUMQYEEEW4QPZ76VXLJTG54BKZJWLFUQG2B2APSZHJB3Y",
                "sdk-version": "2",
                "x-tt-token": "00142b8b1c4f7608d41756604a7e27d0930243df2ab8389e65ea37630344f24fa80e4331752dfaff4fe73f6e482cbc3625dc6cfb16608764ce072db9cf2bb092b1691d04c284b1c3761542dfebfb8839628e43e4b81f9c6bb5a29b5479923f1d97fdf-1.0.1",
                "passport-sdk-version": "30",
                "x-vc-bdturing-sdk-version": "2.0.0",
                "x-tt-store-region": "cn-hb",
                "x-tt-store-region-src": "did",
                "user-agent": "Dalvik/2.1.0 (Linux; U; Android 8.1.0; MI 5X MIUI/9.8.29) NewsArticle/8.5.4 tt-ok/3.10.0.2",
                "cookie": cookie,
                "x-ladon": "qMVtTqVFd1FEoM2ALEAkA9zIwx5uHkTqNLn8UAui1rKSk+B+",
                "x-khronos": "1641559660",
                "x-argus": "TIuTeDWwQPLffvwBAXLrl14YPNFMChvGzF4jcSvSXsWwAS4zo51LZtwHywMxnyDmPh8DrgLjr0tot5OKaBUnSb4OB58OcgxzNk9VOah5fR34qkJpbUriw4xxIB2Y3/MKy6CcczRm+DBR3oKoY5C9F4qVxsHoTMosMhmtzeMLY3MnZVi516oL2L7+7h0+dAM4xi5f5F/YrCTVRMj+22HhqrlD332VN7nZeKn1Nfszu65PERmDSd5/w7LpstApI5MGWvdAnAzy1LO80zjS4qLrhaPZ",
                "x-gorgon": "84046089000117ee80eeb3204d4f09becb1bede66824563a5f9b",
                "content-type": "application/json; charset=utf-8",
                //"content-length": "64"
            },

        };
        $.post(options, (err, resp, data) => {
            try {
                if (err) {
                    console.log('获取阅读金币失败！！\n');
                    console.log(err);
                } else {
                    data = JSON.parse(data);
                    console.log(data)
                    if (data.err_no == 0) {
                        msg = `[今日头条_Jxell]\n获得阅读金币：${data.data.score_amount}`

                    } else {
                        console.log(data)
                    }
                    resolve(msg);
                }
            } catch (e) {
                $.logErr(e, resp);
            }
            finally {
                resolve(msg);
            }
        })
    })
}
async function gobotNotify(text) {
    return new Promise(resolve => {

        const options = {
            url: 'http://192.168.0.105:6700/send_msg',
            json: {
                message: `${text}`,
                group_id:207465865,

            },
            headers: {
                'Content-Type': 'application/json',
            },

        };
        $.post(options, (err, resp, data) => {
            try {
                if (err) {
                    console.log('发送go-cqhttp通知调用API失败！！\n');
                    console.log(err);
                } else {
                    data = JSON.parse(data);
                    console.log(data)
                    // 			if (data.retcode === 0) {
                    // 				console.log('go-cqhttp发送通知消息成功🎉\n');
                    // 			} else if (data.retcode === 100) {
                    // 				console.log(`go-cqhttp发送通知消息异常: ${data.errmsg}\n`);
                    // 			} else {
                    // 				console.log(`go-cqhttp发送通知消息异常\n${JSON.stringify(data)}`);
                    // 			}
                }
            } catch (e) {
                $.logErr(e, resp);
            }
            finally {
                resolve(data);
            }
        });
    })
}

function getday() {
    // 获取当前日期
    var date = new Date();

    // 获取当前月份
    var nowMonth = date.getMonth() + 1;

    // 获取当前是几号
    var strDate = date.getDate();

    // 添加分隔符“-”
    var seperator = "";

    // 对月份进行处理，1-9月在前面添加一个“0”
    if (nowMonth >= 1 && nowMonth <= 9) {
        nowMonth = "0" + nowMonth;
    }

    // 对月份进行处理，1-9号在前面添加一个“0”
    if (strDate >= 0 && strDate <= 9) {
        strDate = "0" + strDate;
    }

    // 最后拼接字符串，得到一个格式为(yyyy-MM-dd)的日期
    var nowDate = date.getFullYear() + seperator + nowMonth + seperator + strDate;
    return nowDate
}
function Env(t, e) {
    class s {
        constructor(t) {
            this.env = t
        }
        send(t, e = "GET") {
            t = "string" == typeof t ? {
                url: t
            } : t;
            let s = this.get;
            return "POST" === e && (s = this.post), new Promise((e, i) => {
                s.call(this, t, (t, s, r) => {
                    t ? i(t) : e(s)
                })
            })
        }
        get(t) {
            return this.send.call(this.env, t)
        }
        post(t) {
            return this.send.call(this.env, t, "POST")
        }
    }
    return new class {
        constructor(t, e) {
            this.name = t, this.http = new s(this), this.data = null, this.dataFile = "box.dat", this.logs = [], this.isMute = !1, this.isNeedRewrite = !1, this.logSeparator = "\n", this.startTime = (new Date).getTime(), Object.assign(this, e), this.log("", `\ud83d\udd14${this.name}, \u5f00\u59cb!`)
        }
        isNode() {
            return "undefined" != typeof module && !!module.exports
        }
        isQuanX() {
            return "undefined" != typeof $task
        }
        isSurge() {
            return "undefined" != typeof $httpClient && "undefined" == typeof $loon
        }
        isLoon() {
            return "undefined" != typeof $loon
        }
        toObj(t, e = null) {
            try {
                return JSON.parse(t)
            } catch {
                return e
            }
        }
        toStr(t, e = null) {
            try {
                return JSON.stringify(t)
            } catch {
                return e
            }
        }
        getjson(t, e) {
            let s = e;
            const i = this.getdata(t);
            if (i) try {
                s = JSON.parse(this.getdata(t))
            } catch { }
            return s
        }
        setjson(t, e) {
            try {
                return this.setdata(JSON.stringify(t), e)
            } catch {
                return !1
            }
        }
        getScript(t) {
            return new Promise(e => {
                this.get({
                    url: t
                }, (t, s, i) => e(i))
            })
        }
        runScript(t, e) {
            return new Promise(s => {
                let i = this.getdata("@chavy_boxjs_userCfgs.httpapi");
                i = i ? i.replace(/\n/g, "").trim() : i;
                let r = this.getdata("@chavy_boxjs_userCfgs.httpapi_timeout");
                r = r ? 1 * r : 20, r = e && e.timeout ? e.timeout : r;
                const [o, h] = i.split("@"), a = {
                    url: `http://${h}/v1/scripting/evaluate`,
                    body: {
                        script_text: t,
                        mock_type: "cron",
                        timeout: r
                    },
                    headers: {
                        "X-Key": o,
                        Accept: "*/*"
                    }
                };
                this.post(a, (t, e, i) => s(i))
            }).catch(t => this.logErr(t))
        }
        loaddata() {
            if (!this.isNode()) return {}; {
                this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
                const t = this.path.resolve(this.dataFile),
                    e = this.path.resolve(process.cwd(), this.dataFile),
                    s = this.fs.existsSync(t),
                    i = !s && this.fs.existsSync(e);
                if (!s && !i) return {}; {
                    const i = s ? t : e;
                    try {
                        return JSON.parse(this.fs.readFileSync(i))
                    } catch (t) {
                        return {}
                    }
                }
            }
        }
        writedata() {
            if (this.isNode()) {
                this.fs = this.fs ? this.fs : require("fs"), this.path = this.path ? this.path : require("path");
                const t = this.path.resolve(this.dataFile),
                    e = this.path.resolve(process.cwd(), this.dataFile),
                    s = this.fs.existsSync(t),
                    i = !s && this.fs.existsSync(e),
                    r = JSON.stringify(this.data);
                s ? this.fs.writeFileSync(t, r) : i ? this.fs.writeFileSync(e, r) : this.fs.writeFileSync(t, r)
            }
        }
        lodash_get(t, e, s) {
            const i = e.replace(/\[(\d+)\]/g, ".$1").split(".");
            let r = t;
            for (const t of i)
                if (r = Object(r)[t], void 0 === r) return s;
            return r
        }
        lodash_set(t, e, s) {
            return Object(t) !== t ? t : (Array.isArray(e) || (e = e.toString().match(/[^.[\]]+/g) || []), e.slice(0, -1).reduce((t, s, i) => Object(t[s]) === t[s] ? t[s] : t[s] = Math.abs(e[i + 1]) >> 0 == +e[i + 1] ? [] : {}, t)[e[e.length - 1]] = s, t)
        }
        getdata(t) {
            let e = this.getval(t);
            if (/^@/.test(t)) {
                const [, s, i] = /^@(.*?)\.(.*?)$/.exec(t), r = s ? this.getval(s) : "";
                if (r) try {
                    const t = JSON.parse(r);
                    e = t ? this.lodash_get(t, i, "") : e
                } catch (t) {
                    e = ""
                }
            }
            return e
        }
        setdata(t, e) {
            let s = !1;
            if (/^@/.test(e)) {
                const [, i, r] = /^@(.*?)\.(.*?)$/.exec(e), o = this.getval(i), h = i ? "null" === o ? null : o || "{}" : "{}";
                try {
                    const e = JSON.parse(h);
                    this.lodash_set(e, r, t), s = this.setval(JSON.stringify(e), i)
                } catch (e) {
                    const o = {};
                    this.lodash_set(o, r, t), s = this.setval(JSON.stringify(o), i)
                }
            } else s = this.setval(t, e);
            return s
        }
        getval(t) {
            return this.isSurge() || this.isLoon() ? $persistentStore.read(t) : this.isQuanX() ? $prefs.valueForKey(t) : this.isNode() ? (this.data = this.loaddata(), this.data[t]) : this.data && this.data[t] || null
        }
        setval(t, e) {
            return this.isSurge() || this.isLoon() ? $persistentStore.write(t, e) : this.isQuanX() ? $prefs.setValueForKey(t, e) : this.isNode() ? (this.data = this.loaddata(), this.data[e] = t, this.writedata(), !0) : this.data && this.data[e] || null
        }
        initGotEnv(t) {
            this.got = this.got ? this.got : require("got"), this.cktough = this.cktough ? this.cktough : require("tough-cookie"), this.ckjar = this.ckjar ? this.ckjar : new this.cktough.CookieJar, t && (t.headers = t.headers ? t.headers : {}, void 0 === t.headers.Cookie && void 0 === t.cookieJar && (t.cookieJar = this.ckjar))
        }
        get(t, e = (() => { })) {
            t.headers && (delete t.headers["Content-Type"], delete t.headers["Content-Length"]), this.isSurge() || this.isLoon() ? (this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, {
                "X-Surge-Skip-Scripting": !1
            })), $httpClient.get(t, (t, s, i) => {
                !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i)
            })) : this.isQuanX() ? (this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, {
                hints: !1
            })), $task.fetch(t).then(t => {
                const {
                    statusCode: s,
                    statusCode: i,
                    headers: r,
                    body: o
                } = t;
                e(null, {
                    status: s,
                    statusCode: i,
                    headers: r,
                    body: o
                }, o)
            }, t => e(t))) : this.isNode() && (this.initGotEnv(t), this.got(t).on("redirect", (t, e) => {
                try {
                    if (t.headers["set-cookie"]) {
                        const s = t.headers["set-cookie"].map(this.cktough.Cookie.parse).toString();
                        s && this.ckjar.setCookieSync(s, null), e.cookieJar = this.ckjar
                    }
                } catch (t) {
                    this.logErr(t)
                }
            }).then(t => {
                const {
                    statusCode: s,
                    statusCode: i,
                    headers: r,
                    body: o
                } = t;
                e(null, {
                    status: s,
                    statusCode: i,
                    headers: r,
                    body: o
                }, o)
            }, t => {
                const {
                    message: s,
                    response: i
                } = t;
                e(s, i, i && i.body)
            }))
        }
        post(t, e = (() => { })) {
            if (t.body && t.headers && !t.headers["Content-Type"] && (t.headers["Content-Type"] = "application/x-www-form-urlencoded"), t.headers && delete t.headers["Content-Length"], this.isSurge() || this.isLoon()) this.isSurge() && this.isNeedRewrite && (t.headers = t.headers || {}, Object.assign(t.headers, {
                "X-Surge-Skip-Scripting": !1
            })), $httpClient.post(t, (t, s, i) => {
                !t && s && (s.body = i, s.statusCode = s.status), e(t, s, i)
            });
            else if (this.isQuanX()) t.method = "POST", this.isNeedRewrite && (t.opts = t.opts || {}, Object.assign(t.opts, {
                hints: !1
            })), $task.fetch(t).then(t => {
                const {
                    statusCode: s,
                    statusCode: i,
                    headers: r,
                    body: o
                } = t;
                e(null, {
                    status: s,
                    statusCode: i,
                    headers: r,
                    body: o
                }, o)
            }, t => e(t));
            else if (this.isNode()) {
                this.initGotEnv(t);
                const {
                    url: s,
                    ...i
                } = t;
                this.got.post(s, i).then(t => {
                    const {
                        statusCode: s,
                        statusCode: i,
                        headers: r,
                        body: o
                    } = t;
                    e(null, {
                        status: s,
                        statusCode: i,
                        headers: r,
                        body: o
                    }, o)
                }, t => {
                    const {
                        message: s,
                        response: i
                    } = t;
                    e(s, i, i && i.body)
                })
            }
        }
        time(t) {
            let e = {
                "M+": (new Date).getMonth() + 1,
                "d+": (new Date).getDate(),
                "H+": (new Date).getHours(),
                "m+": (new Date).getMinutes(),
                "s+": (new Date).getSeconds(),
                "q+": Math.floor(((new Date).getMonth() + 3) / 3),
                S: (new Date).getMilliseconds()
            };
            /(y+)/.test(t) && (t = t.replace(RegExp.$1, ((new Date).getFullYear() + "").substr(4 - RegExp.$1.length)));
            for (let s in e) new RegExp("(" + s + ")").test(t) && (t = t.replace(RegExp.$1, 1 == RegExp.$1.length ? e[s] : ("00" + e[s]).substr(("" + e[s]).length)));
            return t
        }
        msg(e = t, s = "", i = "", r) {
            const o = t => {
                if (!t) return t;
                if ("string" == typeof t) return this.isLoon() ? t : this.isQuanX() ? {
                    "open-url": t
                } : this.isSurge() ? {
                    url: t
                } : void 0;
                if ("object" == typeof t) {
                    if (this.isLoon()) {
                        let e = t.openUrl || t.url || t["open-url"],
                            s = t.mediaUrl || t["media-url"];
                        return {
                            openUrl: e,
                            mediaUrl: s
                        }
                    }
                    if (this.isQuanX()) {
                        let e = t["open-url"] || t.url || t.openUrl,
                            s = t["media-url"] || t.mediaUrl;
                        return {
                            "open-url": e,
                            "media-url": s
                        }
                    }
                    if (this.isSurge()) {
                        let e = t.url || t.openUrl || t["open-url"];
                        return {
                            url: e
                        }
                    }
                }
            };
            if (this.isMute || (this.isSurge() || this.isLoon() ? $notification.post(e, s, i, o(r)) : this.isQuanX() && $notify(e, s, i, o(r))), !this.isMuteLog) {
                let t = ["", "==============\ud83d\udce3\u7cfb\u7edf\u901a\u77e5\ud83d\udce3=============="];
                t.push(e), s && t.push(s), i && t.push(i), console.log(t.join("\n")), this.logs = this.logs.concat(t)
            }
        }
        log(...t) {
            t.length > 0 && (this.logs = [...this.logs, ...t]), console.log(t.join(this.logSeparator))
        }
        logErr(t, e) {
            const s = !this.isSurge() && !this.isQuanX() && !this.isLoon();
            s ? this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t.stack) : this.log("", `\u2757\ufe0f${this.name}, \u9519\u8bef!`, t)
        }
        wait(t) {
            return new Promise(e => setTimeout(e, t))
        }
        done(t = {}) {
            const e = (new Date).getTime(),
                s = (e - this.startTime) / 1e3;
            this.log("", `\ud83d\udd14${this.name}, \u7ed3\u675f! \ud83d\udd5b ${s} \u79d2`), this.log(), (this.isSurge() || this.isQuanX() || this.isLoon()) && $done(t)
        }
    }(t, e)
}